<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>广州微信通讯公司 | 登陆</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.7 -->
    <link rel="stylesheet"
          th:href="@{/static/css/bootstrap.min.css}">
    <!-- Font Awesome -->
    <link rel="stylesheet"
          th:href="@{/static/css/font-awesome.min.css}">
    <!-- Ionicons -->
    <link rel="stylesheet" th:href="@{/static/css/ionicons.min.css}">
    <!-- Theme style -->
    <link rel="stylesheet" th:href="@{/static/css/AdminLTE.min.css}">
    <!-- iCheck -->
    <link rel="stylesheet" th:href="@{/static/css/iCheck/square/blue.css}">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->

    <!-- Google Font -->
    <!--<link rel="stylesheet"
          href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">-->
</head>
<body class="hold-transition login-page">
<div class="login-box">
    <div class="login-logo">
        <a href="#"><b>广州微信通讯</b></a>
    </div>
    <!-- /.login-logo -->
    <div class="login-box-body">
        <p class="login-box-msg">登陆经营管理系统</p>

        <div class="tabbable" id="tabs">
            <ul class="nav nav-tabs">
                <li class="active">
                    <a href="#panelErcode" data-toggle="tab">扫描登录</a>
                </li>
                <li>
                    <a href="#panelUser" data-toggle="tab">账号登录</a>
                </li>
            </ul>
            <div class="tab-content">
                <div class="tab-pane active" id="panelErcode">
                    <div id="login_container"></div>
                </div>
                <div class="tab-pane" id="panelUser">
                    <div>
                    <form method="post" data-toggle="validator">
                        <div class="form-group has-feedback">
                            <input type="text" name="username" class="form-control" placeholder="用户名" data-error="用户名不能为空" required>
                            <span class="glyphicon glyphicon-user form-control-feedback"></span>
                            <div class="help-block with-errors"></div>
                        </div>
                        <div class="form-group has-feedback">
                            <input type="password" name="password" class="form-control" placeholder="密码" data-error="密码不能为空" required>
                            <span class="glyphicon glyphicon-lock form-control-feedback"></span>
                            <div class="help-block with-errors"></div>
                        </div>
                        <div style="color:red;" th:text="${error}"></div>
                        <div class="row">
                            <div class="col-xs-8">
                                <div class="checkbox icheck">
                                    <label>
                                        <input name="rememberMe" type="checkbox"> 自动登陆
                                    </label>
                                </div>
                            </div>
                            <!-- /.col -->
                            <div class="col-xs-4">
                                <button type="submit" class="btn btn-primary btn-block btn-flat">登陆</button>
                            </div>
                            <!-- /.col -->
                        </div>
                    </form>
                    <a href="#">我忘记了密码</a><br>
                    <a href="#" class="text-center">联系公司管理员</a>
                </div>
                </div>
            </div>
        </div>
    </div>
    <!-- /.login-box-body -->
</div>
<!-- /.login-box -->
<!--钉钉免登-->
<script src="//g.alicdn.com/dingding/dinglogin/0.0.5/ddLogin.js"></script>
<!-- jQuery 3 -->
<script th:src="@{/static/js/jquery.min.js}"></script>
<!-- Bootstrap 3.3.7 -->
<script th:src="@{/static/js/bootstrap.min.js}"></script>
<!-- iCheck -->
<script th:src="@{/static/js/icheck.min.js}"></script>
<!-- Bootstrap-validator-0.11.9 -->
<script th:src="@{/static/js/validator.min.js}"></script>
<script>
    $(function () {
        $('input').iCheck({
            checkboxClass: 'icheckbox_square-blue',
            radioClass: 'iradio_square-blue',
            increaseArea: '20%' /* optional */
        });
        var APPID = "dingoa4qdpxe6nqmmouwif";
       // var REDIRECT_URI = "http://forweixinoa.vaiwan.com:8081/wximp/ssoclient/dingding";
        var REDIRECT_URI = "http://39.108.65.220:8086/wximp/ssoclient/dingding";
        var goto = encodeURIComponent('https://oapi.dingtalk.com/connect/oauth2/sns_authorize?appid='+APPID+'&response_type=code&scope=snsapi_login&state=STATE&redirect_uri='+REDIRECT_URI);
        var obj = DDLogin({
            id: "login_container",//这里需要你在自己的页面定义一个HTML标签并设置id，例如<div id="login_container"></div>或<span id="login_container"></span>
            goto: goto, //请参考注释里的方式
            style: "border:none;background-color:#FFFFFF;",
            width: "320",
            height: "400"
        });
        //获取loginTmpCode
        var hanndleMessage = function (event) {
            var origin = event.origin;
            console.log("origin", JSON.stringify(event));
            if (origin == "https://login.dingtalk.com") { //判断是否来自ddLogin扫码事件。
                var loginTmpCode = event.data; //拿到loginTmpCode后就可以在这里构造跳转链接进行跳转了
                console.log("loginTmpCode="+loginTmpCode);
                <!--好大一个坑，大写的参数不用替换，直接保持原样就行了-->
                location.href =  'https://oapi.dingtalk.com/connect/oauth2/sns_authorize?appid=APPID&response_type=code&scope=snsapi_login&state=STATE&redirect_uri=REDIRECT_URI&loginTmpCode='+loginTmpCode;
            }
        };

        if (typeof window.addEventListener != 'undefined') {
            window.addEventListener('message', hanndleMessage, false);
        } else if (typeof window.attachEvent != 'undefined') {
            window.attachEvent('onmessage', hanndleMessage);
        }
    });
</script>
</body>
</html>
